﻿using System.Configuration;
using System.Reflection;

namespace UcAsp.Net.DALFactory
{
    public sealed class DataAccess
    {
        private static readonly string path = ConfigurationManager.AppSettings["DAL"];

        public static UcAsp.Net.IDAL.IAdminUserDAL CreateAdminUser()
        {
            string className = path + ".AdminUserDAL";
            return (UcAsp.Net.IDAL.IAdminUserDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static UcAsp.Net.IDAL.IArticlesDAL CreateArticles()
        {
            string className = path + ".ArticlesDAL";
            return (UcAsp.Net.IDAL.IArticlesDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static UcAsp.Net.IDAL.IArticlesPageDAL CreateArticlesPage()
        {
            string className = path + ".ArticlesPageDAL";
            return (UcAsp.Net.IDAL.IArticlesPageDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static UcAsp.Net.IDAL.ICategoriesDAL CreateCategories()
        {
            string className = path + ".CategoriesDAL";
            return (UcAsp.Net.IDAL.ICategoriesDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static UcAsp.Net.IDAL.ICommentsDAL CreateComments()
        {
            string className = path + ".CommentsDAL";
            return (UcAsp.Net.IDAL.ICommentsDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static UcAsp.Net.IDAL.ICourseDAL CreateCourse()
        {
            string className = path + ".CourseDAL";
            return (UcAsp.Net.IDAL.ICourseDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static UcAsp.Net.IDAL.ISetFiledDAL CreateSetFiled()
        {
            string className = path + ".SetFiledDAL";
            return (UcAsp.Net.IDAL.ISetFiledDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static UcAsp.Net.IDAL.ISysParamDAL CreateSysParam()
        {
            string className = path + ".SysParamDAL";
            return (UcAsp.Net.IDAL.ISysParamDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static UcAsp.Net.IDAL.IUserInfoDAL CreateUserInfo()
        {
            string className = path + ".UserInfoDAL";
            return (UcAsp.Net.IDAL.IUserInfoDAL)Assembly.Load(path).CreateInstance(className);
        }
        public static UcAsp.Net.IDAL.IDefinedCodeDAL CreateDefinedCode()
        {
            string className = path + ".DefinedCodeDAL";
            return (UcAsp.Net.IDAL.IDefinedCodeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static UcAsp.Net.IDAL.IArticlesTagDAL CreateArticlesTag()
        {
            string className = path + ".ArticlesTagDAL";
            return (UcAsp.Net.IDAL.IArticlesTagDAL)Assembly.Load(path).CreateInstance(className);
        }
        public static UcAsp.Net.IDAL.IAttachementFileDAL CreateAttachementFile()
        {
            string className = path + ".AttachementFileDAL";
            return (UcAsp.Net.IDAL.IAttachementFileDAL)Assembly.Load(path).CreateInstance(className);
        }
    }
}